import * as React from 'react';

export interface MenuItemProps {
    name: string;
    text: string;
    onClick: (...args) => void;
    className: string;
}

export class MenuItem extends React.Component<MenuItemProps, {}> {
    constructor(props) {
        super(props);
        this.handleClick = this.handleClick.bind(this);
    }

    handleClick(event) {
        event.preventDefault();
        this.props.onClick(this.props.name);
    }

    render() {
        return <a href="#" className={this.props.className} onClick={this.handleClick}>{this.props.text}</a>
    }
}
